home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / SCSI.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  35.1 KB  |  866 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        SCSI.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT SCSI;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __SCSI__}
  27. {$SETC __SCSI__ := 1}
  28.  
  29. {$I+}
  30. {$SETC SCSIIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __MIXEDMODE__}
  40. {$I MixedMode.p}
  41. {$ENDC}
  42.  
  43. {$PUSH}
  44. {$ALIGN MAC68K}
  45. {$LibExport+}
  46.  
  47. CONST
  48.     scInc                        = 1;
  49.     scNoInc                        = 2;
  50.     scAdd                        = 3;
  51.     scMove                        = 4;
  52.     scLoop                        = 5;
  53.     scNop                        = 6;
  54.     scStop                        = 7;
  55.     scComp                        = 8;
  56.  
  57. { SCSI Manager errors }
  58.     scCommErr                    = 2;                            { communications error, operation timeout }
  59.     scArbNBErr                    = 3;                            { arbitration timeout waiting for not BSY }
  60.     scBadParmsErr                = 4;                            { bad parameter or TIB opcode }
  61.     scPhaseErr                    = 5;                            { SCSI bus not in correct phase for attempted operation }
  62.     scCompareErr                = 6;                            { data compare error }
  63.     scMgrBusyErr                = 7;                            { SCSI Manager busy  }
  64.     scSequenceErr                = 8;                            { attempted operation is out of sequence }
  65.     scBusTOErr                    = 9;                            { CPU bus timeout }
  66.     scComplPhaseErr                = 10;                            { SCSI bus wasn't in Status phase }
  67.  
  68. { Signatures }
  69.     sbSIGWord                    = $4552;                        { signature word for Block 0 ('ER') }
  70.     sbMac                        = 1;                            { system type for Mac }
  71.     pMapSIG                        = $504D;                        { partition map signature ('PM') }
  72.     pdSigWord                    = $5453;
  73.  
  74.     oldPMSigWord                = pdSigWord;
  75.     newPMSigWord                = pMapSIG;
  76.  
  77. { Driver Descriptor Map }
  78.  
  79. TYPE
  80.     Block0 = PACKED RECORD
  81.         sbSig:                    INTEGER;                                { unique value for SCSI block 0 }
  82.         sbBlkSize:                INTEGER;                                { block size of device }
  83.         sbBlkCount:                LONGINT;                                { number of blocks on device }
  84.         sbDevType:                INTEGER;                                { device type }
  85.         sbDevId:                INTEGER;                                { device id }
  86.         sbData:                    LONGINT;                                { not used }
  87.         sbDrvrCount:            INTEGER;                                { driver descriptor count }
  88.         ddBlock:                LONGINT;                                { 1st driver's starting block }
  89.         ddSize:                    INTEGER;                                { size of 1st driver (512-byte blks) }
  90.         ddType:                    INTEGER;                                { system type (1 for Mac+) }
  91.         ddPad:                    ARRAY [0..242] OF INTEGER;                { ARRAY[0..242] OF INTEGER; not used }
  92.     END;
  93. { Partition Map Entry }
  94.     Partition = PACKED RECORD
  95.         pmSig:                    INTEGER;                                { unique value for map entry blk }
  96.         pmSigPad:                INTEGER;                                { currently unused }
  97.         pmMapBlkCnt:            LONGINT;                                { # of blks in partition map }
  98.         pmPyPartStart:            LONGINT;                                { physical start blk of partition }
  99.         pmPartBlkCnt:            LONGINT;                                { # of blks in this partition }
  100.         pmPartName:                PACKED ARRAY [0..31] OF CHAR;            { ASCII partition name }
  101.         pmParType:                PACKED ARRAY [0..31] OF CHAR;            { ASCII partition type }
  102.         pmLgDataStart:            LONGINT;                                { log. # of partition's 1st data blk }
  103.         pmDataCnt:                LONGINT;                                { # of blks in partition's data area }
  104.         pmPartStatus:            LONGINT;                                { bit field for partition status }
  105.         pmLgBootStart:            LONGINT;                                { log. blk of partition's boot code }
  106.         pmBootSize:                LONGINT;                                { number of bytes in boot code }
  107.         pmBootAddr:                LONGINT;                                { memory load address of boot code }
  108.         pmBootAddr2:            LONGINT;                                { currently unused }
  109.         pmBootEntry:            LONGINT;                                { entry point of boot code }
  110.         pmBootEntry2:            LONGINT;                                { currently unused }
  111.         pmBootCksum:            LONGINT;                                { checksum of boot code }
  112.         pmProcessor:            PACKED ARRAY [0..15] OF CHAR;            { ASCII for the processor type }
  113.         pmPad:                    ARRAY [0..187] OF INTEGER;                { 512 bytes long currently unused }
  114.     END;
  115. { TIB instruction }
  116.     SCSIInstr = RECORD
  117.         scOpcode:                INTEGER;
  118.         scParam1:                LONGINT;
  119.         scParam2:                LONGINT;
  120.     END;
  121.  
  122. FUNCTION SCSIReset: OSErr;
  123.     {$IFC NOT GENERATINGCFM}
  124.     INLINE $4267, $A815;
  125.     {$ENDC}
  126. FUNCTION SCSIGet: OSErr;
  127.     {$IFC NOT GENERATINGCFM}
  128.     INLINE $3F3C, $0001, $A815;
  129.     {$ENDC}
  130. FUNCTION SCSISelect(targetID: INTEGER): OSErr;
  131.     {$IFC NOT GENERATINGCFM}
  132.     INLINE $3F3C, $0002, $A815;
  133.     {$ENDC}
  134. FUNCTION SCSICmd(buffer: Ptr; count: INTEGER): OSErr;
  135.     {$IFC NOT GENERATINGCFM}
  136.     INLINE $3F3C, $0003, $A815;
  137.     {$ENDC}
  138. FUNCTION SCSIRead(tibPtr: Ptr): OSErr;
  139.     {$IFC NOT GENERATINGCFM}
  140.     INLINE $3F3C, $0005, $A815;
  141.     {$ENDC}
  142. FUNCTION SCSIRBlind(tibPtr: Ptr): OSErr;
  143.     {$IFC NOT GENERATINGCFM}
  144.     INLINE $3F3C, $0008, $A815;
  145.     {$ENDC}
  146. FUNCTION SCSIWrite(tibPtr: Ptr): OSErr;
  147.     {$IFC NOT GENERATINGCFM}
  148.     INLINE $3F3C, $0006, $A815;
  149.     {$ENDC}
  150. FUNCTION SCSIWBlind(tibPtr: Ptr): OSErr;
  151.     {$IFC NOT GENERATINGCFM}
  152.     INLINE $3F3C, $0009, $A815;
  153.     {$ENDC}
  154. FUNCTION SCSIComplete(VAR stat: INTEGER; VAR message: INTEGER; wait: LONGINT): OSErr;
  155.     {$IFC NOT GENERATINGCFM}
  156.     INLINE $3F3C, $0004, $A815;
  157.     {$ENDC}
  158. FUNCTION SCSIStat: INTEGER;
  159.     {$IFC NOT GENERATINGCFM}
  160.     INLINE $3F3C, $000A, $A815;
  161.     {$ENDC}
  162. FUNCTION SCSISelAtn(targetID: INTEGER): OSErr;
  163.     {$IFC NOT GENERATINGCFM}
  164.     INLINE $3F3C, $000B, $A815;
  165.     {$ENDC}
  166. FUNCTION SCSIMsgIn(VAR message: INTEGER): OSErr;
  167.     {$IFC NOT GENERATINGCFM}
  168.     INLINE $3F3C, $000C, $A815;
  169.     {$ENDC}
  170. FUNCTION SCSIMsgOut(message: INTEGER): OSErr;
  171.     {$IFC NOT GENERATINGCFM}
  172.     INLINE $3F3C, $000D, $A815;
  173.     {$ENDC}
  174. {——————————————————————— New SCSI Manager Interface ———————————————————————}
  175.  
  176. CONST
  177.     scsiVERSION                    = 43;
  178.  
  179. { SCSI Manager function codes }
  180.     SCSINop                        = $00;                            { Execute nothing                                         }
  181.     SCSIExecIO                    = $01;                            { Execute the specified IO                             }
  182.     SCSIBusInquiry                = $03;                            { Get parameters for entire path of HBAs                 }
  183.     SCSIReleaseQ                = $04;                            { Release the frozen SIM queue for particular LUN         }
  184.     SCSIAbortCommand            = $10;                            { Abort the selected Control Block                      }
  185.     SCSIResetBus                = $11;                            { Reset the SCSI bus                                      }
  186.     SCSIResetDevice                = $12;                            { Reset the SCSI device                                  }
  187.     SCSITerminateIO                = $13;                            { Terminate any pending IO                              }
  188.     SCSIGetVirtualIDInfo        = $80;                            { Find out which bus old ID is on                         }
  189.     SCSILoadDriver                = $82;                            { Load a driver for a device ident                     }
  190.     SCSIOldCall                    = $84;                            { XPT->SIM private call for old-API                     }
  191.     SCSICreateRefNumXref        = $85;                            { Register a DeviceIdent to drvr RefNum xref             }
  192.     SCSILookupRefNumXref        = $86;                            { Get DeviceIdent to drvr RefNum xref                     }
  193.     SCSIRemoveRefNumXref        = $87;                            { Remove a DeviceIdent to drvr RefNum xref             }
  194.     SCSIRegisterWithNewXPT        = $88;                            { XPT has changed - SIM needs to re-register itself     }
  195.     vendorUnique                = $C0;                            { 0xC0 thru 0xFF }
  196.  
  197. { SCSI Callback Procedure Prototypes }
  198. TYPE
  199.     SCSICallbackProcPtr = ProcPtr;  { PROCEDURE SCSICallback(scsiPB: UNIV Ptr); }
  200.     AENCallbackProcPtr = ProcPtr;  { PROCEDURE AENCallback; }
  201.     SIMInitProcPtr = ProcPtr;  { FUNCTION SIMInit(SIMinfoPtr: Ptr): OSErr; }
  202.     SIMActionProcPtr = ProcPtr;  { PROCEDURE SIMAction(scsiPB: UNIV Ptr; SIMGlobals: Ptr); }
  203.     SCSIProcPtr = ProcPtr;  { PROCEDURE SCSI; }
  204.     SCSIMakeCallbackProcPtr = ProcPtr;  { PROCEDURE SCSIMakeCallback(scsiPB: UNIV Ptr); }
  205.     SCSIInterruptPollProcPtr = ProcPtr;  { FUNCTION SCSIInterruptPoll(SIMGlobals: Ptr): LONGINT; }
  206.     SCSICallbackUPP = UniversalProcPtr;
  207.     AENCallbackUPP = UniversalProcPtr;
  208.     SIMInitUPP = UniversalProcPtr;
  209.     SIMActionUPP = UniversalProcPtr;
  210.     SCSIUPP = UniversalProcPtr;
  211.     SCSIMakeCallbackUPP = UniversalProcPtr;
  212.     SCSIInterruptPollUPP = UniversalProcPtr;
  213.  
  214. CONST
  215.     uppSCSICallbackProcInfo = $000000C0; { PROCEDURE (4 byte param); }
  216.     uppAENCallbackProcInfo = $00000001; { PROCEDURE ; }
  217.     uppSIMInitProcInfo = $000000E1; { FUNCTION (4 byte param): 2 byte result; }
  218.     uppSIMActionProcInfo = $000003C1; { PROCEDURE (4 byte param, 4 byte param); }
  219.     uppSCSIProcInfo = $00000001; { PROCEDURE ; }
  220.     uppSCSIMakeCallbackProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  221.     uppSCSIInterruptPollProcInfo = $000000F1; { FUNCTION (4 byte param): 4 byte result; }
  222.  
  223. FUNCTION NewSCSICallbackProc(userRoutine: SCSICallbackProcPtr): SCSICallbackUPP;
  224.     {$IFC NOT GENERATINGCFM }
  225.     INLINE $2E9F;
  226.     {$ENDC}
  227.  
  228. FUNCTION NewAENCallbackProc(userRoutine: AENCallbackProcPtr): AENCallbackUPP;
  229.     {$IFC NOT GENERATINGCFM }
  230.     INLINE $2E9F;
  231.     {$ENDC}
  232.  
  233. FUNCTION NewSIMInitProc(userRoutine: SIMInitProcPtr): SIMInitUPP;
  234.     {$IFC NOT GENERATINGCFM }
  235.     INLINE $2E9F;
  236.     {$ENDC}
  237.  
  238. FUNCTION NewSIMActionProc(userRoutine: SIMActionProcPtr): SIMActionUPP;
  239.     {$IFC NOT GENERATINGCFM }
  240.     INLINE $2E9F;
  241.     {$ENDC}
  242.  
  243. FUNCTION NewSCSIProc(userRoutine: SCSIProcPtr): SCSIUPP;
  244.     {$IFC NOT GENERATINGCFM }
  245.     INLINE $2E9F;
  246.     {$ENDC}
  247.  
  248. FUNCTION NewSCSIMakeCallbackProc(userRoutine: SCSIMakeCallbackProcPtr): SCSIMakeCallbackUPP;
  249.     {$IFC NOT GENERATINGCFM }
  250.     INLINE $2E9F;
  251.     {$ENDC}
  252.  
  253. FUNCTION NewSCSIInterruptPollProc(userRoutine: SCSIInterruptPollProcPtr): SCSIInterruptPollUPP;
  254.     {$IFC NOT GENERATINGCFM }
  255.     INLINE $2E9F;
  256.     {$ENDC}
  257.  
  258. PROCEDURE CallSCSICallbackProc(scsiPB: UNIV Ptr; userRoutine: SCSICallbackUPP);
  259.     {$IFC NOT GENERATINGCFM}
  260.     INLINE $205F, $4E90;
  261.     {$ENDC}
  262.  
  263. PROCEDURE CallAENCallbackProc(userRoutine: AENCallbackUPP);
  264.     {$IFC NOT GENERATINGCFM}
  265.     INLINE $205F, $4E90;
  266.     {$ENDC}
  267.  
  268. FUNCTION CallSIMInitProc(SIMinfoPtr: Ptr; userRoutine: SIMInitUPP): OSErr;
  269.     {$IFC NOT GENERATINGCFM}
  270.     INLINE $205F, $4E90;
  271.     {$ENDC}
  272.  
  273. PROCEDURE CallSIMActionProc(scsiPB: UNIV Ptr; SIMGlobals: Ptr; userRoutine: SIMActionUPP);
  274.     {$IFC NOT GENERATINGCFM}
  275.     INLINE $205F, $4E90;
  276.     {$ENDC}
  277.  
  278. PROCEDURE CallSCSIProc(userRoutine: SCSIUPP);
  279.     {$IFC NOT GENERATINGCFM}
  280.     INLINE $205F, $4E90;
  281.     {$ENDC}
  282.  
  283. PROCEDURE CallSCSIMakeCallbackProc(scsiPB: UNIV Ptr; userRoutine: SCSIMakeCallbackUPP);
  284.     {$IFC NOT GENERATINGCFM}
  285.     INLINE $205F, $4E90;
  286.     {$ENDC}
  287.  
  288. FUNCTION CallSCSIInterruptPollProc(SIMGlobals: Ptr; userRoutine: SCSIInterruptPollUPP): LONGINT;
  289.     {$IFC NOT GENERATINGCFM}
  290.     INLINE $205F, $4E90;
  291.     {$ENDC}
  292.  
  293. CONST
  294.     handshakeDataLength            = 8;                            { Handshake data length }
  295.     maxCDBLength                = 16;                            { Space for the CDB bytes/pointer }
  296.     vendorIDLength                = 16;                            { ASCII string len for Vendor ID  }
  297.  
  298. { Define DeviceIdent structure }
  299.  
  300. TYPE
  301.     DeviceIdent = PACKED RECORD
  302.         diReserved:                UInt8;                                    { reserved                 }
  303.         bus:                    UInt8;                                    { SCSI - Bus Number        }
  304.         targetID:                UInt8;                                    { SCSI - Target SCSI ID    }
  305.         LUN:                    UInt8;                                    { SCSI - LUN                  }
  306.     END;
  307. { Command Descriptor Block structure }
  308.     CDB = ARRAY [0..maxCDBLength-1] OF UInt8;
  309.  
  310.     SGRecord = RECORD
  311.         SGAddr:                    Ptr;
  312.         SGCount:                UInt32;
  313.     END;
  314. { SCSI Phases (used by SIMs to support the Original SCSI Manager }
  315.  
  316. CONST
  317.     kDataOutPhase                = 0;                            { Encoded MSG, C/D, I/O bits }
  318.     kDataInPhase                = 1;
  319.     kCommandPhase                = 2;
  320.     kStatusPhase                = 3;
  321.     kPhaseIllegal0                = 4;
  322.     kPhaseIllegal1                = 5;
  323.     kMessageOutPhase            = 6;
  324.     kMessageInPhase                = 7;
  325.     kBusFreePhase                = 8;                            { Additional Phases }
  326.     kArbitratePhase                = 9;
  327.     kSelectPhase                = 10;
  328.     kMessageInPhaseNACK            = 11;                            { Message In Phase with ACK hanging on the bus }
  329.  
  330.  
  331. TYPE
  332.     SCSIHdr = RECORD
  333.         qLink:                    ^SCSIHdr;
  334.         scsiReserved1:            INTEGER;
  335.         scsiPBLength:            UInt16;
  336.         scsiFunctionCode:        SInt8;
  337.         scsiReserved2:            SInt8;
  338.         scsiResult:                OSErr;
  339.         scsiDevice:                DeviceIdent;
  340.         scsiCompletion:            SCSICallbackUPP;
  341.         scsiFlags:                UInt32;
  342.         scsiDriverStorage:        ^UInt8;
  343.         scsiXPTprivate:            Ptr;
  344.         scsiReserved3:            LONGINT;
  345.     END;
  346.     SCSI_PB = RECORD
  347.         qLink:                    ^SCSIHdr;
  348.         scsiReserved1:            INTEGER;
  349.         scsiPBLength:            UInt16;
  350.         scsiFunctionCode:        SInt8;
  351.         scsiReserved2:            SInt8;
  352.         scsiResult:                OSErr;
  353.         scsiDevice:                DeviceIdent;
  354.         scsiCompletion:            SCSICallbackUPP;
  355.         scsiFlags:                UInt32;
  356.         scsiDriverStorage:        ^UInt8;
  357.         scsiXPTprivate:            Ptr;
  358.         scsiReserved3:            LONGINT;
  359.     END;
  360.     SCSI_IO = RECORD
  361.         qLink:                    ^SCSIHdr;
  362.         scsiReserved1:            INTEGER;
  363.         scsiPBLength:            UInt16;
  364.         scsiFunctionCode:        SInt8;
  365.         scsiReserved2:            SInt8;
  366.         scsiResult:                OSErr;
  367.         scsiDevice:                DeviceIdent;
  368.         scsiCompletion:            SCSICallbackUPP;
  369.         scsiFlags:                UInt32;
  370.         scsiDriverStorage:        ^UInt8;
  371.         scsiXPTprivate:            Ptr;
  372.         scsiReserved3:            LONGINT;
  373.         scsiResultFlags:        UInt16;
  374.         scsiReserved3pt5:        UInt16;
  375.         scsiDataPtr:            ^UInt8;
  376.         scsiDataLength:            UInt32;
  377.         scsiSensePtr:            ^UInt8;
  378.         scsiSenseLength:        SInt8;
  379.         scsiCDBLength:            SInt8;
  380.         scsiSGListCount:        UInt16;
  381.         scsiReserved4:            UInt32;
  382.         scsiSCSIstatus:            SInt8;
  383.         scsiSenseResidual:        SInt8;
  384.         scsiReserved5:            UInt16;
  385.         scsiDataResidual:        LONGINT;
  386.         scsiCDB:                CDB;
  387.         scsiTimeout:            LONGINT;
  388.         scsiReserved5pt5:        ^UInt8;
  389.         scsiReserved5pt6:        UInt16;
  390.         scsiIOFlags:            UInt16;
  391.         scsiTagAction:            SInt8;
  392.         scsiReserved6:            SInt8;
  393.         scsiReserved7:            UInt16;
  394.         scsiSelectTimeout:        UInt16;
  395.         scsiDataType:            SInt8;
  396.         scsiTransferType:        SInt8;
  397.         scsiReserved8:            UInt32;
  398.         scsiReserved9:            UInt32;
  399.         scsiHandshake:            ARRAY [0..handshakeDataLength-1] OF UInt16;
  400.         scsiReserved10:            UInt32;
  401.         scsiReserved11:            UInt32;
  402.         scsiCommandLink:        ^SCSI_IO;
  403.         scsiSIMpublics:            ARRAY [0..7] OF SInt8;
  404.         scsiAppleReserved6:        ARRAY [0..7] OF SInt8;
  405.         scsiCurrentPhase:        UInt16;
  406.         scsiSelector:            INTEGER;
  407.         scsiOldCallResult:        OSErr;
  408.         scsiSCSImessage:        SInt8;
  409.         XPTprivateFlags:        SInt8;
  410.         XPTextras:                ARRAY [0..11] OF SInt8;
  411.     END;
  412.     SCSIExecIOPB = SCSI_IO;
  413.  
  414. { Bus inquiry PB }
  415.     SCSIBusInquiryPB = RECORD
  416.         qLink:                    ^SCSIHdr;
  417.         scsiReserved1:            INTEGER;
  418.         scsiPBLength:            UInt16;
  419.         scsiFunctionCode:        SInt8;
  420.         scsiReserved2:            SInt8;
  421.         scsiResult:                OSErr;
  422.         scsiDevice:                DeviceIdent;
  423.         scsiCompletion:            SCSICallbackUPP;
  424.         scsiFlags:                UInt32;
  425.         scsiDriverStorage:        ^UInt8;
  426.         scsiXPTprivate:            Ptr;
  427.         scsiReserved3:            LONGINT;
  428.         scsiEngineCount:        UInt16;                                    { <- Number of engines on HBA                         }
  429.         scsiMaxTransferType:    UInt16;                                    { <- Number of transfer types for this HBA            }
  430.         scsiDataTypes:            UInt32;                                    { <- which data types are supported by this SIM     }
  431.         scsiIOpbSize:            UInt16;                                    { <- Size of SCSI_IO PB for this SIM/HBA             }
  432.         scsiMaxIOpbSize:        UInt16;                                    { <- Size of max SCSI_IO PB for all SIM/HBAs         }
  433.         scsiFeatureFlags:        UInt32;                                    { <- Supported features flags field                 }
  434.         scsiVersionNumber:        SInt8;                                    { <- Version number for the SIM/HBA                 }
  435.         scsiHBAInquiry:            SInt8;                                    { <- Mimic of INQ byte 7 for the HBA                 }
  436.         scsiTargetModeFlags:    SInt8;                                    { <- Flags for target mode support                 }
  437.         scsiScanFlags:            SInt8;                                    { <- Scan related feature flags                     }
  438.         scsiSIMPrivatesPtr:        UInt32;                                    { <- Ptr to SIM private data area                     }
  439.         scsiSIMPrivatesSize:    UInt32;                                    { <- Size of SIM private data area                 }
  440.         scsiAsyncFlags:            UInt32;                                    { <- Event cap. for Async Callback                 }
  441.         scsiHiBusID:            SInt8;                                    { <- Highest path ID in the subsystem              }
  442.         scsiInitiatorID:        SInt8;                                    { <- ID of the HBA on the SCSI bus                 }
  443.         scsiBIReserved0:        UInt16;                                    {                                                    }
  444.         scsiBIReserved1:        UInt32;                                    { <-                                                  }
  445.         scsiFlagsSupported:        UInt32;                                    { <- which scsiFlags are supported                 }
  446.         scsiIOFlagsSupported:    UInt16;                                    { <- which scsiIOFlags are supported                 }
  447.         scsiWeirdStuff:            UInt16;                                    { <-                                                 }
  448.         scsiMaxTarget:            UInt16;                                    { <- maximum Target number supported                 }
  449.         scsiMaxLUN:                UInt16;                                    { <- maximum Logical Unit number supported         }
  450.         scsiSIMVendor:            PACKED ARRAY [0..vendorIDLength-1] OF CHAR; { <- Vendor ID of SIM (or XPT if bus<FF)         }
  451.         scsiHBAVendor:            PACKED ARRAY [0..vendorIDLength-1] OF CHAR; { <- Vendor ID of the HBA                         }
  452.         scsiControllerFamily:    PACKED ARRAY [0..vendorIDLength-1] OF CHAR; { <- Family of SCSI Controller                 }
  453.         scsiControllerType:        PACKED ARRAY [0..vendorIDLength-1] OF CHAR; { <- Specific Model of SCSI Controller used     }
  454.         scsiXPTversion:            PACKED ARRAY [0..3] OF CHAR;            { <- version number of XPT                         }
  455.         scsiSIMversion:            PACKED ARRAY [0..3] OF CHAR;            { <- version number of SIM                         }
  456.         scsiHBAversion:            PACKED ARRAY [0..3] OF CHAR;            { <- version number of HBA                         }
  457.         scsiHBAslotType:        SInt8;                                    { <- type of "slot" that this HBA is in            }
  458.         scsiHBAslotNumber:        SInt8;                                    { <- slot number of this HBA                         }
  459.         scsiSIMsRsrcID:            UInt16;                                    { <- resource ID of this SIM                         }
  460.         scsiBIReserved3:        UInt16;                                    { <-                                                 }
  461.         scsiAdditionalLength:    UInt16;                                    { <- additional BusInquiry PB len                    }
  462.     END;
  463. { Abort SIM Request PB }
  464.     SCSIAbortCommandPB = RECORD
  465.         qLink:                    ^SCSIHdr;
  466.         scsiReserved1:            INTEGER;
  467.         scsiPBLength:            UInt16;
  468.         scsiFunctionCode:        SInt8;
  469.         scsiReserved2:            SInt8;
  470.         scsiResult:                OSErr;
  471.         scsiDevice:                DeviceIdent;
  472.         scsiCompletion:            SCSICallbackUPP;
  473.         scsiFlags:                UInt32;
  474.         scsiDriverStorage:        ^UInt8;
  475.         scsiXPTprivate:            Ptr;
  476.         scsiReserved3:            LONGINT;
  477.         scsiIOptr:                ^SCSI_IO;                                { Pointer to the PB to abort                        }
  478.     END;
  479. { Terminate I/O Process Request PB }
  480.     SCSITerminateIOPB = RECORD
  481.         qLink:                    ^SCSIHdr;
  482.         scsiReserved1:            INTEGER;
  483.         scsiPBLength:            UInt16;
  484.         scsiFunctionCode:        SInt8;
  485.         scsiReserved2:            SInt8;
  486.         scsiResult:                OSErr;
  487.         scsiDevice:                DeviceIdent;
  488.         scsiCompletion:            SCSICallbackUPP;
  489.         scsiFlags:                UInt32;
  490.         scsiDriverStorage:        ^UInt8;
  491.         scsiXPTprivate:            Ptr;
  492.         scsiReserved3:            LONGINT;
  493.         scsiIOptr:                ^SCSI_IO;                                { Pointer to the PB to terminate                     }
  494.     END;
  495. { Reset SCSI Bus PB }
  496.     SCSIResetBusPB = RECORD
  497.         qLink:                    ^SCSIHdr;
  498.         scsiReserved1:            INTEGER;
  499.         scsiPBLength:            UInt16;
  500.         scsiFunctionCode:        SInt8;
  501.         scsiReserved2:            SInt8;
  502.         scsiResult:                OSErr;
  503.         scsiDevice:                DeviceIdent;
  504.         scsiCompletion:            SCSICallbackUPP;
  505.         scsiFlags:                UInt32;
  506.         scsiDriverStorage:        ^UInt8;
  507.         scsiXPTprivate:            Ptr;
  508.         scsiReserved3:            LONGINT;
  509.     END;
  510. { Reset SCSI Device PB }
  511.     SCSIResetDevicePB = RECORD
  512.         qLink:                    ^SCSIHdr;
  513.         scsiReserved1:            INTEGER;
  514.         scsiPBLength:            UInt16;
  515.         scsiFunctionCode:        SInt8;
  516.         scsiReserved2:            SInt8;
  517.         scsiResult:                OSErr;
  518.         scsiDevice:                DeviceIdent;
  519.         scsiCompletion:            SCSICallbackUPP;
  520.         scsiFlags:                UInt32;
  521.         scsiDriverStorage:        ^UInt8;
  522.         scsiXPTprivate:            Ptr;
  523.         scsiReserved3:            LONGINT;
  524.     END;
  525. { Release SIM Queue PB }
  526.     SCSIReleaseQPB = RECORD
  527.         qLink:                    ^SCSIHdr;
  528.         scsiReserved1:            INTEGER;
  529.         scsiPBLength:            UInt16;
  530.         scsiFunctionCode:        SInt8;
  531.         scsiReserved2:            SInt8;
  532.         scsiResult:                OSErr;
  533.         scsiDevice:                DeviceIdent;
  534.         scsiCompletion:            SCSICallbackUPP;
  535.         scsiFlags:                UInt32;
  536.         scsiDriverStorage:        ^UInt8;
  537.         scsiXPTprivate:            Ptr;
  538.         scsiReserved3:            LONGINT;
  539.     END;
  540. { SCSI Get Virtual ID Info PB }
  541.     SCSIGetVirtualIDInfoPB = RECORD
  542.         qLink:                    ^SCSIHdr;
  543.         scsiReserved1:            INTEGER;
  544.         scsiPBLength:            UInt16;
  545.         scsiFunctionCode:        SInt8;
  546.         scsiReserved2:            SInt8;
  547.         scsiResult:                OSErr;
  548.         scsiDevice:                DeviceIdent;
  549.         scsiCompletion:            SCSICallbackUPP;
  550.         scsiFlags:                UInt32;
  551.         scsiDriverStorage:        ^UInt8;
  552.         scsiXPTprivate:            Ptr;
  553.         scsiReserved3:            LONGINT;
  554.         scsiOldCallID:            UInt16;                                    { -> SCSI ID of device in question             }
  555.         scsiExists:                BOOLEAN;                                { <- true if device exists                     }
  556.     END;
  557. { Create/Lookup/Remove RefNum for Device PB }
  558.     SCSIDriverPB = RECORD
  559.         qLink:                    ^SCSIHdr;
  560.         scsiReserved1:            INTEGER;
  561.         scsiPBLength:            UInt16;
  562.         scsiFunctionCode:        SInt8;
  563.         scsiReserved2:            SInt8;
  564.         scsiResult:                OSErr;
  565.         scsiDevice:                DeviceIdent;
  566.         scsiCompletion:            SCSICallbackUPP;
  567.         scsiFlags:                UInt32;
  568.         scsiDriverStorage:        ^UInt8;
  569.         scsiXPTprivate:            Ptr;
  570.         scsiReserved3:            LONGINT;
  571.         scsiDriver:                INTEGER;                                { -> DriverRefNum, For SetDriver, <- For GetNextDriver }
  572.         scsiDriverFlags:        UInt16;                                    { <> Details of driver/device                     }
  573.         scsiNextDevice:            DeviceIdent;                            { <- DeviceIdent of the NEXT Item in the list  }
  574.     END;
  575. { Load Driver PB }
  576.     SCSILoadDriverPB = RECORD
  577.         qLink:                    ^SCSIHdr;
  578.         scsiReserved1:            INTEGER;
  579.         scsiPBLength:            UInt16;
  580.         scsiFunctionCode:        SInt8;
  581.         scsiReserved2:            SInt8;
  582.         scsiResult:                OSErr;
  583.         scsiDevice:                DeviceIdent;
  584.         scsiCompletion:            SCSICallbackUPP;
  585.         scsiFlags:                UInt32;
  586.         scsiDriverStorage:        ^UInt8;
  587.         scsiXPTprivate:            Ptr;
  588.         scsiReserved3:            LONGINT;
  589.         scsiLoadedRefNum:        INTEGER;                                { <- SIM returns refnum of driver                     }
  590.         scsiDiskLoadFailed:        BOOLEAN;                                { -> if true, indicates call after failure to load }
  591.     END;
  592. { Defines for the scsiTransferType field }
  593.  
  594. CONST
  595.     scsiTransferBlind            = 0;
  596.     scsiTransferPolled            = 1;
  597.  
  598. { Defines for the scsiDataType field }
  599.     scsiDataBuffer                = 0;                            { single contiguous buffer supplied                  }
  600.     scsiDataTIB                    = 1;                            { TIB supplied (ptr in scsiDataPtr)                 }
  601.     scsiDataSG                    = 2;                            { scatter/gather list supplied                      }
  602.  
  603. { Defines for the SCSIMgr scsiResult field in the PB header. }
  604. {  $E100 thru  E1FF }
  605. { -$1EFF thru -1E00 }
  606. { -#7935 thru -7681  }
  607. { = 0xE100 }
  608.     scsiErrorBase                = -7936;
  609.  
  610.     scsiRequestInProgress        = 1;                            { 1     = PB request is in progress             }
  611. { Execution failed  00-2F }
  612.     scsiRequestAborted            = scsiErrorBase + 2;            { -7934 = PB request aborted by the host         }
  613.     scsiUnableToAbort            = scsiErrorBase + 3;            { -7933 = Unable to Abort PB request             }
  614.     scsiNonZeroStatus            = scsiErrorBase + 4;            { -7932 = PB request completed with an err     }
  615.     scsiUnused05                = scsiErrorBase + 5;            { -7931 =                                      }
  616.     scsiUnused06                = scsiErrorBase + 6;            { -7930 =                                      }
  617.     scsiUnused07                = scsiErrorBase + 7;            { -7929 =                                      }
  618.     scsiUnused08                = scsiErrorBase + 8;            { -7928 =                                      }
  619.     scsiUnableToTerminate        = scsiErrorBase + 9;            { -7927 = Unable to Terminate I/O PB req         }
  620.     scsiSelectTimeout            = scsiErrorBase + 10;            { -7926 = Target selection timeout             }
  621.     scsiCommandTimeout            = scsiErrorBase + 11;            { -7925 = Command timeout                      }
  622.     scsiIdentifyMessageRejected    = scsiErrorBase + 12;            { -7924 =                                      }
  623.     scsiMessageRejectReceived    = scsiErrorBase + 13;            { -7923 = Message reject received                 }
  624.     scsiSCSIBusReset            = scsiErrorBase + 14;            { -7922 = SCSI bus reset sent/received         }
  625.     scsiParityError                = scsiErrorBase + 15;            { -7921 = Uncorrectable parity error occured     }
  626.     scsiAutosenseFailed            = scsiErrorBase + 16;            { -7920 = Autosense: Request sense cmd fail     }
  627.     scsiUnused11                = scsiErrorBase + 17;            { -7919 =                                      }
  628.     scsiDataRunError            = scsiErrorBase + 18;            { -7918 = Data overrun/underrun error          }
  629.     scsiUnexpectedBusFree        = scsiErrorBase + 19;            { -7917 = Unexpected BUS free                     }
  630.     scsiSequenceFailed            = scsiErrorBase + 20;            { -7916 = Target bus phase sequence failure     }
  631.     scsiWrongDirection            = scsiErrorBase + 21;            { -7915 = Data phase was in wrong direction     }
  632.     scsiUnused16                = scsiErrorBase + 22;            { -7914 =                                      }
  633.     scsiBDRsent                    = scsiErrorBase + 23;            { -7913 = A SCSI BDR msg was sent to target     }
  634.     scsiTerminated                = scsiErrorBase + 24;            { -7912 = PB request terminated by the host     }
  635.     scsiNoNexus                    = scsiErrorBase + 25;            { -7911 = Nexus is not established             }
  636.     scsiCDBReceived                = scsiErrorBase + 26;            { -7910 = The SCSI CDB has been received         }
  637. { Couldn't begin execution  30-3F }
  638.     scsiTooManyBuses            = scsiErrorBase + 48;            { -7888 = Register failed because we're full    }
  639.     scsiBusy                    = scsiErrorBase + 49;            { -7887 = SCSI subsystem is busy                 }
  640.     scsiProvideFail                = scsiErrorBase + 50;            { -7886 = Unable to provide requ. capability    }
  641.     scsiDeviceNotThere            = scsiErrorBase + 51;            { -7885 = SCSI device not installed/there      }
  642.     scsiNoHBA                    = scsiErrorBase + 52;            { -7884 = No HBA detected Error                 }
  643.     scsiDeviceConflict            = scsiErrorBase + 53;            { -7883 = sorry, max 1 refNum per DeviceIdent     }
  644.     scsiNoSuchXref                = scsiErrorBase + 54;            { -7882 = no such RefNum xref                     }
  645.     scsiQLinkInvalid            = scsiErrorBase + 55;            { -7881 = pre-linked PBs not supported            
  646.                                                                    (The QLink field was nonzero)        }
  647. { Parameter errors  40-7F }
  648.     scsiPBLengthError            = scsiErrorBase + 64;            { -7872 = (scsiPBLength is insuf'ct/invalid     }
  649.     scsiFunctionNotAvailable    = scsiErrorBase + 65;            { -7871 = The requ. func is not available      }
  650.     scsiRequestInvalid            = scsiErrorBase + 66;            { -7870 = PB request is invalid                 }
  651.     scsiBusInvalid                = scsiErrorBase + 67;            { -7869 = Bus ID supplied is invalid              }
  652.     scsiTIDInvalid                = scsiErrorBase + 68;            { -7868 = Target ID supplied is invalid         }
  653.     scsiLUNInvalid                = scsiErrorBase + 69;            { -7867 = LUN supplied is invalid              }
  654.     scsiIDInvalid                = scsiErrorBase + 70;            { -7866 = The initiator ID is invalid          }
  655.     scsiDataTypeInvalid            = scsiErrorBase + 71;            { -7865 = scsiDataType requested not supported }
  656.     scsiTransferTypeInvalid        = scsiErrorBase + 72;            { -7864 = scsiTransferType field is too high     }
  657.     scsiCDBLengthInvalid        = scsiErrorBase + 73;            { -7863 = scsiCDBLength field is too big         }
  658.  
  659.     scsiExecutionErrors            = scsiErrorBase;
  660.     scsiNotExecutedErrors        = scsiTooManyBuses;
  661.     scsiParameterErrors            = scsiPBLengthError;
  662.  
  663. { Defines for the scsiResultFlags field }
  664.     scsiSIMQFrozen                = $0001;                        { The SIM queue is frozen w/this err            }
  665.     scsiAutosenseValid            = $0002;                        { Autosense data valid for target              }
  666.     scsiBusNotFree                = $0004;                        { At time of callback, SCSI bus is not free    }
  667.  
  668. { Defines for the bit numbers of the scsiFlags field in the PB header for the SCSIExecIO function }
  669.     kbSCSIDisableAutosense        = 29;                            { Disable auto sense feature                     }
  670.     kbSCSIFlagReservedA            = 28;                            {                                              }
  671.     kbSCSIFlagReserved0            = 27;                            {                                              }
  672.     kbSCSICDBLinked                = 26;                            { The PB contains a linked CDB                    }
  673.     kbSCSIQEnable                = 25;                            { Target queue actions are enabled                }
  674.     kbSCSICDBIsPointer            = 24;                            { The CDB field contains a pointer                }
  675.     kbSCSIFlagReserved1            = 23;                            {                                                 }
  676.     kbSCSIInitiateSyncData        = 22;                            { Attempt Sync data xfer and SDTR                }
  677.     kbSCSIDisableSyncData        = 21;                            { Disable sync, go to async                    }
  678.     kbSCSISIMQHead                = 20;                            { Place PB at the head of SIM Q                }
  679.     kbSCSISIMQFreeze            = 19;                            { Return the SIM Q to frozen state                }
  680.     kbSCSISIMQNoFreeze            = 18;                            { Disallow SIM Q freezing                        }
  681.     kbSCSIDoDisconnect            = 17;                            { Definitely do disconnect                        }
  682.     kbSCSIDontDisconnect        = 16;                            { Definitely don't disconnect                    }
  683.     kbSCSIDataReadyForDMA        = 15;                            { Data buffer(s) are ready for DMA                }
  684.     kbSCSIFlagReserved3            = 14;                            {                                                 }
  685.     kbSCSIDataPhysical            = 13;                            { SG/Buffer data ptrs are physical                }
  686.     kbSCSISensePhysical            = 12;                            { Autosense buffer ptr is physical                }
  687.     kbSCSIFlagReserved5            = 11;                            {                                                 }
  688.     kbSCSIFlagReserved6            = 10;                            {                                                 }
  689.     kbSCSIFlagReserved7            = 9;                            {                                                 }
  690.     kbSCSIFlagReserved8            = 8;                            {                                                 }
  691.     kbSCSIDataBufferValid        = 7;                            { Data buffer valid                            }
  692.     kbSCSIStatusBufferValid        = 6;                            { Status buffer valid                             }
  693.     kbSCSIMessageBufferValid    = 5;                            { Message buffer valid                            }
  694.     kbSCSIFlagReserved9            = 4;                            {                                              }
  695.  
  696. { Defines for the bit masks of the scsiFlags field }
  697.     scsiDirectionMask            = $C0000000;                    { Data direction mask                        }
  698.     scsiDirectionNone            = $C0000000;                    { Data direction (11: no data)                }
  699.     scsiDirectionReserved        = $00000000;                    { Data direction (00: reserved)            }
  700.     scsiDirectionOut            = $80000000;                    { Data direction (10: DATA OUT)            }
  701.     scsiDirectionIn                = $40000000;                    { Data direction (01: DATA IN)                }
  702.     scsiDisableAutosense        = $20000000;                    { Disable auto sense feature                }
  703.     scsiFlagReservedA            = $10000000;                    {                                             }
  704.     scsiFlagReserved0            = $08000000;                    {                                             }
  705.     scsiCDBLinked                = $04000000;                    { The PB contains a linked CDB                }
  706.     scsiQEnable                    = $02000000;                    { Target queue actions are enabled            }
  707.     scsiCDBIsPointer            = $01000000;                    { The CDB field contains a pointer            }
  708.     scsiFlagReserved1            = $00800000;                    {                                             }
  709.     scsiInitiateSyncData        = $00400000;                    { Attempt Sync data xfer and SDTR            }
  710.     scsiDisableSyncData            = $00200000;                    { Disable sync, go to async                }
  711.     scsiSIMQHead                = $00100000;                    { Place PB at the head of SIM Q            }
  712.     scsiSIMQFreeze                = $00080000;                    { Return the SIM Q to frozen state            }
  713.     scsiSIMQNoFreeze            = $00040000;                    { Disallow SIM Q freezing                    }
  714.     scsiDoDisconnect            = $00020000;                    { Definitely do disconnect                    }
  715.     scsiDontDisconnect            = $00010000;                    { Definitely don't disconnect                }
  716.     scsiDataReadyForDMA            = $00008000;                    { Data buffer(s) are ready for DMA            }
  717.     scsiFlagReserved3            = $00004000;                    {  }
  718.     scsiDataPhysical            = $00002000;                    { SG/Buffer data ptrs are physical            }
  719.     scsiSensePhysical            = $00001000;                    { Autosense buffer ptr is physical            }
  720.     scsiFlagReserved5            = $00000800;                    {                                          }
  721.     scsiFlagReserved6            = $00000400;                    {                                             }
  722.     scsiFlagReserved7            = $00000200;                    {                                             }
  723.     scsiFlagReserved8            = $00000100;                    {                                             }
  724.  
  725. { bit masks for the scsiIOFlags field in SCSIExecIOPB }
  726.     scsiNoParityCheck            = $0002;                        { disable parity checking                             }
  727.     scsiDisableSelectWAtn        = $0004;                        { disable select w/Atn                              }
  728.     scsiSavePtrOnDisconnect        = $0008;                        { do SaveDataPointer upon Disconnect msg             }
  729.     scsiNoBucketIn                = $0010;                        { don’t bit bucket in during this I/O                 }
  730.     scsiNoBucketOut                = $0020;                        { don’t bit bucket out during this I/O             }
  731.     scsiDisableWide                = $0040;                        { disable wide transfer negotiation                 }
  732.     scsiInitiateWide            = $0080;                        { initiate wide transfer negotiation                 }
  733.     scsiRenegotiateSense        = $0100;                        { renegotiate sync/wide before issuing autosense     }
  734.     scsiDisableDiscipline        = $0200;                        { disable parameter checking on SCSIExecIO calls    }
  735.     scsiIOFlagReserved0080        = $0080;                        {                                                  }
  736.     scsiIOFlagReserved8000        = $8000;                        {                                                     }
  737.  
  738. { Defines for the SIM/HBA queue actions.  These values are used in the }
  739. { SCSIExecIOPB, for the queue action field. [These values should match the }
  740. { defines from some other include file for the SCSI message phases.  We may }
  741. { not need these definitions here. ] }
  742.     scsiSimpleQTag                = $20;                            { Tag for a simple queue                                 }
  743.     scsiHeadQTag                = $21;                            { Tag for head of queue                                  }
  744.     scsiOrderedQTag                = $22;                            { Tag for ordered queue                                 }
  745.  
  746. { Defines for the Bus Inquiry PB fields. }
  747. { scsiHBAInquiry field bits }
  748.     scsiBusMDP                    = $80;                            { Supports Modify Data Pointer message                        }
  749.     scsiBusWide32                = $40;                            { Supports 32 bit wide SCSI                                }
  750.     scsiBusWide16                = $20;                            { Supports 16 bit wide SCSI                                }
  751.     scsiBusSDTR                    = $10;                            { Supports Sync Data Transfer Req message                    }
  752.     scsiBusLinkedCDB            = $08;                            { Supports linked CDBs                                        }
  753.     scsiBusTagQ                    = $02;                            { Supports tag queue message                                }
  754.     scsiBusSoftReset            = $01;                            { Supports soft reset                                        }
  755.  
  756. { scsiDataTypes field bits  }
  757. {    bits 0->15 Apple-defined, 16->30 3rd-party unique, 31 = reserved }
  758.     scsiBusDataTIB                = 0+(1 * (2**(scsiDataTIB)));    { TIB supplied (ptr in scsiDataPtr)        }
  759.     scsiBusDataBuffer            = 0+(1 * (2**(scsiDataBuffer))); { single contiguous buffer supplied         }
  760.     scsiBusDataSG                = 0+(1 * (2**(scsiDataSG)));    { scatter/gather list supplied             }
  761.     scsiBusDataReserved            = $80000000;                    {                                           }
  762.  
  763. { scsiScanFlags field bits }
  764.     scsiBusScansDevices            = $80;                            { Bus scans for and maintains device list            }
  765.     scsiBusScansOnInit            = $40;                            { Bus scans performed at power-up/reboot            }
  766.     scsiBusLoadsROMDrivers        = $20;                            { may load ROM drivers to support targets             }
  767.  
  768. { scsiFeatureFlags field bits }
  769.     scsiBusInternalExternalMask    = $000000C0;                    { bus internal/external mask                    }
  770.     scsiBusInternalExternalUnknown = $00000000;                    { not known whether bus is inside or outside     }
  771.     scsiBusInternalExternal        = $000000C0;                    { bus goes inside and outside the box             }
  772.     scsiBusInternal                = $00000080;                    { bus goes inside the box                         }
  773.     scsiBusExternal                = $00000040;                    { bus goes outside the box                     }
  774.     scsiBusCacheCoherentDMA        = $00000020;                    { DMA is cache coherent                         }
  775.     scsiBusOldCallCapable        = $00000010;                    { SIM is old call capable                         }
  776.     scsiBusDifferential            = $00000004;                    { Single Ended (0) or Differential (1)         }
  777.     scsiBusFastSCSI                = $00000002;                    { HBA supports fast SCSI                         }
  778.     scsiBusDMAavailable            = $00000001;                    { DMA is available                             }
  779.  
  780. { scsiWeirdStuff field bits }
  781.     scsiOddDisconnectUnsafeRead1 = $0001;                        { Disconnects on odd byte boundries are unsafe with DMA and/or blind reads }
  782.     scsiOddDisconnectUnsafeWrite1 = $0002;                        { Disconnects on odd byte boundries are unsafe with DMA and/or blind writes }
  783.     scsiBusErrorsUnsafe            = $0004;                        { Non-handshaked delays or disconnects during blind transfers may cause a crash }
  784.     scsiRequiresHandshake        = $0008;                        { Non-handshaked delays or disconnects during blind transfers may cause data corruption }
  785.     scsiTargetDrivenSDTRSafe    = $0010;                        { Targets which initiate synchronous negotiations are supported }
  786.  
  787. { scsiHBAslotType values }
  788.     scsiMotherboardBus            = $01;                            { A built in Apple supplied bus                     }
  789.     scsiNuBus                    = $02;                            { A SIM on a NuBus card                             }
  790.     scsiPDSBus                    = $03;                            {    "  on a PDS card                                }
  791.     scsiPCIBus                    = $04;                            {    "  on a PCI bus card                            }
  792.     scsiPCMCIABus                = $05;                            {    "  on a PCMCIA card                            }
  793.     scsiFireWireBridgeBus        = $06;                            {    "  connected through a FireWire bridge        }
  794.  
  795. { Defines for the scsiDriverFlags field (in SCSIDriverPB) }
  796.     scsiDeviceSensitive            = $0001;                        { Only driver should access this device                }
  797.     scsiDeviceNoOldCallAccess    = $0002;                        { no old call access to this device                     }
  798.  
  799. {  SIMInitInfo PB }
  800. { directions are for SCSIRegisterBus call ( -> parm, <- result)             }
  801.  
  802. TYPE
  803.     SIMInitInfo = RECORD
  804.         SIMstaticPtr:            ^UInt8;                                    { <- alloc. ptr to the SIM's static vars                 }
  805.         staticSize:                LONGINT;                                { -> num bytes SIM needs for static vars                 }
  806.         SIMInit:                SIMInitUPP;                                { -> pointer to the SIM init routine                     }
  807.         SIMAction:                SIMActionUPP;                            { -> pointer to the SIM action routine                 }
  808.         SIM_ISR:                SCSIUPP;                                {       reserved                                             }
  809.         SIMInterruptPoll:        SCSIInterruptPollUPP;                    { -> pointer to the SIM interrupt poll routine            }
  810.         NewOldCall:                SIMActionUPP;                            { -> pointer to the SIM NewOldCall routine                }
  811.         ioPBSize:                UInt16;                                    { -> size of SCSI_IO_PBs required for this SIM            }
  812.         oldCallCapable:            BOOLEAN;                                { -> true if this SIM can handle old-API calls            }
  813.         simInfoUnused1:            SInt8;                                    {       reserved                                            }
  814.         simInternalUse:            LONGINT;                                { xx not affected or viewed by XPT                        }
  815.         XPT_ISR:                SCSIUPP;                                {    reserved                                            }
  816.         EnteringSIM:            SCSIUPP;                                { <- ptr to the EnteringSIM routine                    }
  817.         ExitingSIM:                SCSIUPP;                                { <- ptr to the ExitingSIM routine                        }
  818.         MakeCallback:            SCSIMakeCallbackUPP;                    { <- the XPT layer’s SCSIMakeCallback routine            }
  819.         busID:                    UInt16;                                    { <- bus number for the registered bus                    }
  820.         simInfoUnused3:            UInt16;                                    { <- reserved                                            }
  821.         simInfoUnused4:            LONGINT;                                { <- reserved                                            }
  822.     END;
  823. { Glue between SCSI calls and SCSITrap format }
  824.  
  825. CONST
  826.     xptSCSIAction                = $0001;
  827.     xptSCSIRegisterBus            = $0002;
  828.     xptSCSIDeregisterBus        = $0003;
  829.     xptSCSIReregisterBus        = $0004;
  830.     xptSCSIKillXPT                = $0005;                        { kills Mini-XPT after transition }
  831.     xptSCSIInitialize            = $000A;                        { Initialize the SCSI manager }
  832.  
  833. { moveq #kSCSIx, D0;  _SCSIAtomic }
  834.  
  835. FUNCTION SCSIAction(VAR parameterBlock: SCSI_PB): OSErr;
  836.     {$IFC NOT GENERATINGCFM}
  837.     INLINE $205F, $7001, $A089, $3E80;
  838.     {$ENDC}
  839. FUNCTION SCSIRegisterBus(VAR parameterBlock: SIMInitInfo): OSErr;
  840.     {$IFC NOT GENERATINGCFM}
  841.     INLINE $205F, $7002, $A089, $3E80;
  842.     {$ENDC}
  843. FUNCTION SCSIDeregisterBus(VAR parameterBlock: SCSI_PB): OSErr;
  844.     {$IFC NOT GENERATINGCFM}
  845.     INLINE $205F, $7003, $A089, $3E80;
  846.     {$ENDC}
  847. FUNCTION SCSIReregisterBus(VAR parameterBlock: SIMInitInfo): OSErr;
  848.     {$IFC NOT GENERATINGCFM}
  849.     INLINE $205F, $7004, $A089, $3E80;
  850.     {$ENDC}
  851. FUNCTION SCSIKillXPT(VAR parameterBlock: SIMInitInfo): OSErr;
  852.     {$IFC NOT GENERATINGCFM}
  853.     INLINE $205F, $7005, $A089, $3E80;
  854.     {$ENDC}
  855.  
  856. {$ALIGN RESET}
  857. {$POP}
  858.  
  859. {$SETC UsingIncludes := SCSIIncludes}
  860.  
  861. {$ENDC} {__SCSI__}
  862.  
  863. {$IFC NOT UsingIncludes}
  864.  END.
  865. {$ENDC}
  866.